package woordvoorspeller.main;

import woordvoorspeller.gui.WordListWidget;
import javax.swing.JFrame;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

//TODO: fix main
public class Main 
{
	public static void main(String[] args)
	{
		try {
			UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
		}
		catch (UnsupportedLookAndFeelException e) 
		{
		    // handle exception
		}
		catch (ClassNotFoundException e) 
		{
			// handle exception
		}
		catch (InstantiationException e) 
		{
		    // handle exception
		}
		catch (IllegalAccessException e) 
		{
		    // handle exception
		}		
		
		JFrame frame = new JFrame("Woordvoorspeller");
		WordListWidget widget = new WordListWidget();
		frame.setContentPane(widget);
		frame.setSize(300, 150);
		frame.setResizable(false);		
		frame.setVisible(true);
		frame.setDefaultCloseOperation(doClose(widget));
	}
	
	public static int doClose(WordListWidget widget)
	{
		widget.getWordList().exportWordFile();
		return 1;
	}
}
